package com.qf.zyh.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    public static final SimpleDateFormat SDF = new SimpleDateFormat("yy-mm-dd");

    public static Date stringtodate(String s){
        try {
            return SDF.parse(s);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String datetostring(Date date){
        return SDF.format(date);
    }

    public static Date utiltosql(Date date){
        return new java.sql.Date(date.getTime());
    }
    public static Date stringtosql(String s){
        return new java.sql.Date(stringtodate(s).getTime());
    }













}
